autowatch=1;
function load(bpname, pname){
    var bp=this.patcher.newdefault(this.box.rect[0],this.box.rect[1],"bpatcher");
    bp.message('name',pname);
}


function replace_when_loaded(pname, pid, x, y, w, h){
    var p=this.patcher;
  //  var pp=p.parentpatcher;
    if(p){
        var bp=p.newdefault(x,y,"bpatcher");
            bp.message("presentation",1);
            bp.message("args",pid);
            bp.message("patching_rect",x,y,w,h);
            bp.message("presentation_rect",x,y,w,h);
            bp.message("name",pname);
            bp.sendbox("bgmode",2);
            bp.sendbox("bgcolor",1,1,1,1);
            var fo =p.firstobject;
            post(fo.maxclass+'\n');
            while(fo){
                post(fo.maxclass+'\n');
                fo=fo.nextobject;
            }
    } else {
        post('error, no parent patcher..');
    }
}

function get_path(){
    var p=this.patcher;
    var path=p.filepath;
    if(!path){
        var i=0;
        while(!path && i<20){
            p=p.parentpatcher;
            path=p.filepath;
            i++;
        }
    }
    var output = path.substr(0, path.lastIndexOf('/')) || path;
    outlet(0, ['path', output+'/']);
}